//
//  SLDasheLine.swift
//  sulit-loan
//
//  Created by 王刚锋 on 2025/4/18.
//  Copyright © 2025 coolBoy. All rights reserved.
//

import UIKit


class SLDasheLine: UIView {
    override func draw(_ rect: CGRect) {
        super.draw(rect)
        
        // 创建路径
        let path = UIBezierPath()
        path.move(to: CGPoint(x: 0, y: bounds.midY))
        path.addLine(to: CGPoint(x: bounds.width, y: bounds.midY))
        
        // 创建形状图层
        let shapeLayer = CAShapeLayer()
        shapeLayer.strokeColor = rgba(hex: "#8F8F8F", a: 0.3).cgColor
        shapeLayer.lineWidth = 1
        shapeLayer.lineDashPattern = [4, 2] // 虚线模式: 4pt实线，2pt空白
        shapeLayer.path = path.cgPath
        
        // 添加到视图的图层
        layer.addSublayer(shapeLayer)
    }
}

